﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ListenMusic.Video_ServiceReference;
using System.ServiceModel;
namespace ListenMusic.Models.Reposistory.Public
{
    public class VideoReposistory
    {
        VideoServiceClient videoClient;
        public VideoReposistory()
        {
            videoClient = new VideoServiceClient();
        }
        public List<View_BXH_Video> getBXH_Video()
        {
            try {
                View_BXH_Video[] bxh_Video = videoClient.getBXH_Video();
                return bxh_Video.ToList();
            }
            catch (FaultException e) { throw e; }
        }
        public List<Song> get10Video_bySingerid(int singerid)
        {
            try
            {
                Song[] video = videoClient.get10Song_bySingerid(singerid);
                return video.ToList();
            }
            catch (FaultException e) { throw e; }
        }
        public List<View12_Random_Video> get12Random_Video()
        {
            try
            {
                View12_Random_Video[] video = videoClient.get12Random_Video();
                return video.ToList();
            }
            catch (FaultException e) { throw e; }
        }
        public List<SongSinger> getVideo_byCategoryID(int categoryid, int typeid)
        {
            try
            {
                SongSinger[] video = videoClient.getVideo_byCategoryID(categoryid, typeid);
                return video.ToList();
            }
            catch (FaultException e) { throw e; }
        }
        public List<SongSinger> getRandom10Video_byCategoryID(int categoryid, int typeid)
        {
            try
            {
                SongSinger[] video = videoClient.getRandom10Video_byCategoryID(categoryid, typeid);
                return video.ToList();
            }
            catch (FaultException e) { throw e; }
        }
        public List<SongSinger> getAllVideo_bySingerID(int singerid, int typeid)
        {
            try
            {
                SongSinger[] video = videoClient.getAllVideo_bySingerID(singerid, typeid);
                return video.ToList();
            }
            catch (FaultException e) { throw e; }
        }
        public List<SongSinger> getAllVideo_bySingerName(int start, int end,string singerName, int typeid)
        {
            try
            {
                SongSinger[] video = videoClient.getAllVideo_bySingerName(singerName, typeid);
                return video.Skip(start).Take(end).ToList();
            }
            catch (FaultException e) { throw e; }
        }
        public int countVideo_bySingerName(string singerName, int typeid)
        {
            return videoClient.getAllVideo_bySingerName(singerName, typeid).Count();
        }
        public List<SongSinger> getAllVideo_byVideoName(int start, int end,string videoName, int typeid)
        {
            try
            {
                SongSinger[] video = videoClient.getAllVideo_byVideoName(videoName, typeid);
                return video.Skip(start).Take(end).ToList();
            }
            catch (FaultException e) { throw e; }
        }
        public int countAllVideo_byVideoName(string videoName, int typeid)
        {
            return videoClient.getAllVideo_byVideoName(videoName, typeid).Count();
        }
    }
}